package io;

import java.io.Serializable;
import java.util.Arrays;

public class Person implements Serializable {
    private String name;        // 性别
    private int age;            // 年龄
    private String gender;      // 性别
//    private transient String[] otherInfo; // 其他信息
    private String[] otherInfo; // 其他信息

    /**
     * transient
     * 用transient修饰的变量在对象序列化时会被忽略
     * */

    public Person(String name, int age, String gender, String[] otherInfo) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.otherInfo = otherInfo;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String[] getOtherInfo() {
        return otherInfo;
    }

    public void setOtherInfo(String[] otherInfo) {
        this.otherInfo = otherInfo;
    }

    @Override
    public String toString() {
        return "姓名：" + name + "\n性别：" + gender + "\n年龄：" + age + "\n其他信息：" + Arrays.toString(otherInfo);
    }
}
